import os
import time
import tkinter as tk

def saveFile(text):
    localtime = time.asctime( time.localtime(time.time()))
    content = text.get(1.0, "end-1c")
    with open(localtime + ".txt","w") as f:
        f.write(content)
        f.close() 
        text.delete(1.0,tk.END)


window = tk.Tk()
window.title('my window')
window.geometry('500x600')

l=tk.Label(window,text='memo',font=('Arial',12),width=12,height=3)
l.pack()


text_box=tk.Text(window,height=30)
text_box.pack()

b=tk.Button(window,text='Save',width=10,heigh=2,command=lambda : saveFile(text_box))
b.pack()


window.mainloop()